<%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ page import="entity.WarningThreshold" %>
        <html>

        <head>
            <title>编辑预警阈值</title>
            <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
            <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css" rel="stylesheet">
            <style>
                body {
                    background-color: #f8f9fa;
                    padding-top: 2rem;
                }

                .container {
                    max-width: 800px;
                }
            </style>
        </head>

        <body>
            <% WarningThreshold threshold=(WarningThreshold) request.getAttribute("threshold"); %>
                <div class="container">
                    <div class="d-flex align-items-center mb-4">
                        <a href="warningThresholdManage.jsp" class="btn btn-outline-secondary me-3">
                            <i class="bi bi-arrow-left"></i> 返回
                        </a>
                        <h2>编辑预警阈值</h2>
                    </div>

                    <div class="card">
                        <div class="card-body">
                            <form action="${pageContext.request.contextPath}/admin/warningThreshold/update"
                                method="post">
                                <input type="hidden" name="id" value="<%= threshold.getId() %>">

                                <div class="mb-3">
                                    <label class="form-label">预警阈值</label>
                                    <input type="number" class="form-control" name="threshold"
                                        value="<%= threshold.getThreshold() %>" step="0.01" min="0" required>
                                </div>

                                <div class="mb-3">
                                    <label class="form-label">状态</label>
                                    <select class="form-select" name="status">
                                        <option value="1" <%=threshold.getStatus()==1 ? "selected" : "" %>>启用</option>
                                        <option value="0" <%=threshold.getStatus()==0 ? "selected" : "" %>>禁用</option>
                                    </select>
                                </div>

                                <div class="text-end">
                                    <button type="button" class="btn btn-secondary me-2"
                                        onclick="history.back()">取消</button>
                                    <button type="submit" class="btn btn-primary">保存修改</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
        </body>

        </html>